# 名称:Backdream
# 时间2022/12/26  21:55
# 食谱页面类

from appium.webdriver.common.mobileby import MobileBy as By
from pages.base_page import BasePage


class FoodPage(BasePage):
    '''定位器'''
    # 翡翠饺子食谱 定位器
    food_dump_locator = (By.ID, "com.gfeng.daydaycook:id/title")

    def food_dump(self):
        return self.driver.find_element(*self.food_dump_locator).text

    # 面食定位器
    food_mian_locator = (By.XPATH,
                         "//android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.ListView[2]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[1]/android.widget.GridView[1]/android.widget.RelativeLayout[4]/android.widget.RelativeLayout[1]/android.widget.RelativeLayout[1]/android.widget.ImageView[1]")

    def food_mian(self):
        self.driver.find_element(*self.food_mian_locator).click()

    # 断言肉丝炒面
    food_rosemian_locator=(By.XPATH,"//android.widget.TextView[@text=\"肉丝炒面[简易粉面食谱]\"]")
    def food_rosemian(self):
        return self.driver.find_element(*self.food_rosemian_locator).text

